<template>
	<view class="indexs">
		<view class="header header_wi" :style="'padding-top: ' + navH + 'px;'">
			<view class="header_height" :style="'height:' + gaodu + 'px;line-height:' + gaodu + 'px;top:' + gaodutops + 'px;'">
				<view class="index_h_cont3">
					<view class="index_wenben_img" @tap="jumpzuo"><image :src="imgUrl + '/dzx_img33.png'" mode="widthFix"></image></view>
					<view class="index_wenben">{{ $t('page_jiyunxinxi.shipping_information') }}</view>
				</view>
			</view>
			<view class="coloe_title">s</view>
		</view>
		<view class="index_center" :style="'padding-top:' + (navH + 50) + 'px;'">
			<view class="jiyunxinxi_center">
				<view class="jiyunxinxi_item1">
					<view class="jiyunxinxi_item1_t1">{{ $t('page_jiyunxinxi.freight_information') }}</view>
					<view class="jiyunxinxi_item2_dis">
						<view class="jiyunxinxi_item1_t2">{{ $t('page_jiyunxinxi.line_name') }}</view>
						<view class="jiyunxinxi_item1_t3">{{ xiangqingdetails.name }}</view>
					</view>
					<view class="jiyunxinxi_item2_dis">
						<view class="jiyunxinxi_item1_t2">{{ $t('page_jiyunxinxi.billing_mode') }}</view>
						<view class="jiyunxinxi_item1_t3">{{ modelname[xiangqingdetails.free_mode - 1] }}</view>
					</view>
					<view class="jiyunxinxi_item2_dis">
						<view class="jiyunxinxi_item1_t2">{{ $t('page_jiyunxinxi.age_delivery') }}</view>
						<view class="jiyunxinxi_item1_t3">{{ xiangqingdetails.limitationofdelivery }}</view>
					</view>
				</view>

				<view class="jiyunxinxi_item1">
					<view class="jiyunxinxi_item1_t1">{{ $t('page_jiyunxinxi.billing_standard') }}</view>
					<view class="th">
						<view class="ths">{{ $t('page_jiyunxinxi.cost_information') }}</view>
						<view class="ths">{{ $t('page_jiyunxinxi.calculation_rule') }}</view>
						<view class="ths">{{ $t('page_jiyunxinxi.expense') }}</view>
					</view>
					<!-- 首续重 -->
					<view class="thh" v-if="xiangqingdetails.free_mode == 2" v-for="(item, index) in xiangqingdetails.free_rule" :key="index">
						<view class="ths">
							<text style="display: block;">{{ $t('page_jiyunxinxi.head_weight') }}{{ item.first_weight }}{{ xiangqingdetails.line_type_unit_name }}</text>
							<text>{{ price_mode.unit }}{{ item.first_price }}/{{ item.first_weight }}{{ xiangqingdetails.line_type_unit_name }}</text>
						</view>
						<view class="ths">
							<text style="display: block;">{{ $t('page_jiyunxinxi.reweight') }}{{ item.next_weight }}{{ xiangqingdetails.line_type_unit_name }}</text>
							<text>{{ price_mode.unit }}{{ item.next_price }}/{{ item.next_weight }}{{ xiangqingdetails.line_type_unit_name }}</text>
						</view>
						<view class="ths"> - </view>
					</view>
					<!-- 重量区间计费 -->
					<view class="thh" v-if="xiangqingdetails.free_mode == 1 || xiangqingdetails.free_mode == 4" v-for="(item, index) in xiangqingdetails.free_rule" :key="index">
						<view class="ths">{{ item.weight[0] }}{{ item.weight[1] ? '-' + item.weight[1] : '' }}{{ xiangqingdetails.line_type_unit_name }}</view>
						<view class="ths">{{ price_mode.unit }}{{ item.weight_price }}/{{ xiangqingdetails.line_type_unit_name }}</view>
						<view class="ths"> - </view>
					</view>
					<!-- 区间计费 -->
					<view class="thh" v-if="xiangqingdetails.free_mode == 3" v-for="(item, index) in xiangqingdetails.free_rule" :key="index">
						<view class="ths">{{ item.weight[0] }}{{ item.weight[1] ? '-' + item.weight[1] : '' }}{{ xiangqingdetails.line_type_unit_name }}</view>
						<view class="ths">{{ price_mode.unit }}{{ item.weight_price }}</view>
						<view class="ths"> - </view>
					</view>
					<!-- 混合计费 -->
					<view v-if="xiangqingdetails.free_mode == 5" v-for="(item, index) in xiangqingdetails.free_rule" :key="index">
						<view class="thh" v-if="item.type==1">
							<view class="ths">{{ item.weight[0] }}{{ item.weight[1] ? '-' + item.weight[1] : '' }}{{ xiangqingdetails.line_type_unit_name }}</view>
							<view class="ths">
								<text style="display: block;">{{ $t('page_jiyunxinxi.head_weight') }}{{ item.first_weight }}{{ xiangqingdetails.line_type_unit_name }}</text>
								<text>{{ price_mode.unit }}{{ item.first_price }}/{{ item.first_weight }}{{ xiangqingdetails.line_type_unit_name }}</text>
							</view>
							<view class="ths">
								<text style="display: block;">{{ $t('page_jiyunxinxi.reweight') }}{{ item.next_weight }}{{ xiangqingdetails.line_type_unit_name }}</text>
								<text>{{ price_mode.unit }}{{ item.next_price }}/{{ item.next_weight }}{{ xiangqingdetails.line_type_unit_name }}</text>
							</view>
						</view>
						<view class="thh" v-if="item.type== 2">
							<view class="ths">{{ item.weight[0] }}{{ item.weight[1] ? '-' + item.weight[1] : '' }}{{ xiangqingdetails.line_type_unit_name }}</view>
							<view class="ths">{{ price_mode.unit }}{{ item.weight_price }}/{{ xiangqingdetails.line_type_unit_name }}</view>
							<view class="ths"> - </view>
						</view>
						<view class="thh" v-if="item.type==3">
							<view class="ths">{{ item.weight[0] }}{{ item.weight[1] ? '-' + item.weight[1] : '' }}{{ xiangqingdetails.line_type_unit_name }}</view>
							<view class="ths">{{ price_mode.unit }}{{ item.weight_price }}</view>
							<view class="ths"> - </view>
						</view>
					</view>
					<!-- 阶梯首续重计费 -->
					<view v-if="xiangqingdetails.free_mode == 6" v-for="(item, index) in xiangqingdetails.free_rule" :key="index">
						<view class="thh">
							<view class="ths">{{ item.weight[0] }}{{ item.weight[1] ? '-' + item.weight[1] : '' }}{{ xiangqingdetails.line_type_unit_name }}</view>
							<view class="ths">
								<text style="display: block;">{{ $t('page_jiyunxinxi.head_weight') }}{{ item.first_weight }}{{ xiangqingdetails.line_type_unit_name }}</text>
								<text>{{ price_mode.unit }}{{ item.first_price }}/{{ item.first_weight }}{{ xiangqingdetails.line_type_unit_name }}</text>
							</view>
							<view class="ths">
								<text style="display: block;">{{ $t('page_jiyunxinxi.reweight') }}{{ item.next_weight }}{{ xiangqingdetails.line_type_unit_name }}</text>
								<text>{{ price_mode.unit }}{{ item.next_price }}/{{ item.next_weight }}{{ xiangqingdetails.line_type_unit_name }}</text>
							</view>
						</view>
					</view>
					<view class="thh">
						<view class="tch"></view>
						<view class="tch"></view>
						<view class="tch"></view>
					</view>
					<view class="thh">
						<view class="ths">{{ $t('page_jiyunxinxi.anticipated_tariff') }}</view>
						<!-- 		<view class="ths"> &nbsp;&nbsp; </view> -->
						<view class="ths" style="width: 69%; text-align: left">{{ xiangqingdetails.tariff ? xiangqingdetails.tariff : '未知' }}</view>
					</view>
					<view class="thh">
						<view class="ths">{{ setting.service_othername }}</view>
						<view class="ths">&nbsp;&nbsp;</view>
						<view class="ths">{{ price_mode.unit }}{{ service ? service : 0 }}</view>
					</view>
					<view class="thh">
						<view class="ths">{{ $t('page_jiyunxinxi.freight') }}</view>
						<view class="ths"></view>
						<view class="ths">{{ price_mode.unit }}{{ yprice ? yprice : '' }}</view>
					</view>
					<view class="thh">
						<view class="ths">{{ $t('page_jiyunxinxi.total_cost') }}</view>
						<view class="ths ftc">{{ weight ? weight : 0 }}{{ xiangqingdetails.line_type_unit_name }}</view>
						<view class="ths ftc">{{ price_mode.unit }}{{ price ? price : '' }}</view>
					</view>
				</view>
				<view class="jiyunxinxi_item1" v-if="xiangqingdetails.line_special">
					<view class="jiyunxinxi_item1_t1">{{ $t('page_jiyunxinxi.lineCharacteristics') }}</view>
					<view class="jiyunxinxi_item1_t2">{{ xiangqingdetails.line_special ? xiangqingdetails.line_special : '' }}</view>
				</view>
				<view class="jiyunxinxi_item1">
					<view class="jiyunxinxi_item3_dis" v-if="xiangqingdetails.goods_limit">
						<view class="jiyunxinxi_item1_t1">{{ $t('page_jiyunxinxi.article_restriction') }}</view>
						<view class="jiyunxinxi_item1_t2">{{ xiangqingdetails.goods_limit ? xiangqingdetails.goods_limit : '' }}</view>
					</view>
					<view class="jiyunxinxi_item3_dis" v-if="xiangqingdetails.weight_limit">
						<view class="jiyunxinxi_item1_t1">{{ $t('page_jiyunxinxi.weight_limit') }}</view>
						<view class="jiyunxinxi_item1_t2">{{ xiangqingdetails.weight_limit ? xiangqingdetails.weight_limit : '' }}</view>
					</view>
					<view class="jiyunxinxi_item3_dis" v-if="xiangqingdetails.length_limit">
						<view class="jiyunxinxi_item1_t1">{{ $t('page_jiyunxinxi.volume_limitation') }}</view>
						<view class="jiyunxinxi_item1_t2">{{ xiangqingdetails.length_limit ? xiangqingdetails.length_limit : '' }}</view>
					</view>
				</view>
				<view class="jiyunxinxi_item1" v-if="xiangqingdetails.line_content">
					<view class="jiyunxinxi_item1_t1" style="padding-bottom: 20px">{{ $t('page_jiyunxinxi.more_rules') }}</view>
					<rich-text :nodes="xiangqingdetails.line_content ? xiangqingdetails.line_content : ''"></rich-text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
// pages/shouye/shouye_zkc/shouye_zkc.js
const app = getApp();

let request = require('../../../utils/require');

export default {
	data() {
		return {
			navH: app.globalData.navHeight,
			gaodu: app.globalData.height,
			gaodutops: app.globalData.top,
			imgUrl: app.globalData.imgUrl,
			setting: uni.getStorageSync('setting'),
			weight_mode: uni.getStorageSync('weight_mode'),
			price_mode: uni.getStorageSync('price_mode'),
			modelname: [this.$t('page_other.阶梯计费'),this.$t('page_other.首续重计费'), this.$t('page_other.范围区间计费'),this.$t('page_other.重量区间计费'),this.$t('page_other.混合计费模式'),this.$t('page_other.阶梯首续重计费')],
			xiangqingdetails: {
				name: '',
				free_mode: '',
				limitationofdelivery: '',
				free_rule: [],
				services_require: false,
				xiangqingdetails: '',
				weight_limit: '',
				length_limit: '',
				line_content: ''
			},

			ids: '',
			weight: '',
			price: '',
			yprice: '',
			service: ''
		};
	},
	/**
	 * 生命周期函数--监听页面加载
	 */ onLoad(options) {
		var that = this;
		that.ids = options.id
		that.weight = options.weight
		that.price = options.price
		that.service =options.service
		that.yprice = options.yprice
	},
	onShow() {
		var that = this;
		that.xiangqing();
	},
	/**
	 * 生命周期函数--监听页面初次渲染完成
	 */
	onReady: function() {},
	/**
	 * 生命周期函数--监听页面隐藏
	 */
	onHide: function() {},
	/**
	 * 生命周期函数--监听页面卸载
	 */
	onUnload: function() {},
	/**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
	onPullDownRefresh: function() {},
	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom: function() {},
	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage: function() {},
	methods: {
		jumpzuo() {
			uni.navigateBack();
		},

		xiangqing() {
			var that = this;
			var data = {
				id: that.ids
			};
			request.get(`index.php?s=/api/page/lineDetails&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				if (res.data.code == 1) {
					that.xiangqingdetails= res.data.data,
					that.xiangqingdetails.line_content= res.data.data.line_content.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"')
						
					console.log(res, 'res????');
				}
			});
		}
	}
};
</script>
<style>
@import './jiyunxinxi.css';
</style>
